<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/views/global/taglibs.jsp" %>
<!DOCTYPE>
<html>
  <head>
    <base href="<%=basePath %>">
    <title>WELCOME to SEAHELLO</title>
	
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link href="static/css/global/generic.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="static/css/page/invitation.css" />
	
  </head>
  
  <body>
		<div class="centerarea">
			<div class="picarea">
				<ul>
					<li><img src="static/images/page/invitation/head_pic.png"
						style="padding: 40px 0 0 110px; width: 35px;"></li>
					<li><img src="static/images/page/invitation/head_pic2.png"
						style="padding: 76px 0 0 110px; width: 35px;"></li>
					<li><img src="static/images/page/invitation/head_pic3.png"
						style="padding: 76px 0 0 45px; width: 70px;"></li>
					<li><img src="static/images/page/invitation/head_pic4.png"
						style="padding: 100px 0 0 497px; width: 43px;"></li>
				</ul>
			</div>
			<div class="codearea font">
				<div class="codeleft"></div>
				<div class="codecenter">
					<ul>
						<li><p id="timeshow" class="timeshow"></p>
						<%-- <font class="number">${testUserCount }</font> --%>
							<p class="timeshow">WELCOME.
							<%-- <font style="color: #d5372b;font-size: 20px;">${testUserCount }</font> --%>欢迎您！</p></li>
						<li><div class="code_title">SEAHELLO</div></li>
						<li style="float: right; margin-top: 22px;">
							<div class="code_head">
								INVITATION CODE 邀请码
								<input type="text" id="code" name="code" onkeypress="javascript:autoSubmit(event);"/>
								<a href="javascript:void(0)" class="enterhome"><font id="codefont">>>></font></a>
							</div>
							<p class="code_tip">SORRY.PLEASE TYPE AGAIN.<br> 邀请码错误，请重新输入！</p></li>

					</ul>
				</div>
				<div class="coderight"></div>
			</div>
			<div class="picarea">
				<ul>
					<li><img src="static/images/page/invitation/head_pic5.png"
						style="padding:30px 0 0 932px; width: 60px;"></li>
					<li><img src="static/images/page/invitation/head_pic6.png"
						style="padding-left: 35px; width: 43px;"></li>
				</ul>
			</div>
		</div>
	<%@include file="/views/global/scripts.jsp" %>
  </body>
<script type="text/javascript">
$(document).ready(function(){
	$("#code").focus();
	time();
	$('#code').bind('input propertychange', function() {autoSubmit(event);});   //
});

function autoSubmit(event){	
	var code=$("#code").val();
	if(code.length==4){
		$.postEx("invitation/checkCode", {code: $("#code").val()}, function(jsonData){
			if(false == jsonData.success){
				$(".code_tip").show();	
				$("#codefont").attr("color","#fff");
			} else {
				$(".code_tip").hide();
				$("#codefont").attr("color","#d5372b");
				$(".enterhome").attr("href","/default");
				if(event.keyCode==13){
				window.location.href="/default";
				}
			}
		}, "json");
	}
	else{
		$("#codefont").attr("color","#fff");
		$(".code_tip").hide();
	}
}

var t = null;
function time() {
	dt = new Date();
	var year = dt.getFullYear(); //年
	var month = dt.getMonth() + 1 > 9 ? dt.getMonth() + 1 : "0"
			+ (dt.getMonth() + 1); //月
	var day = dt.getDate() > 9 ? dt.getDate() : "0" + dt.getDate(); //日
	var h = dt.getHours();
	var m = dt.getMinutes() > 9 ? dt.getMinutes() : "0" + dt.getMinutes();
	if (h - 12 > 0)
		$("#timeshow").text(
				"PM " + ((h - 12) > 9 ? h : "0" + (h - 12)) + ":" + m
						+ "  " + +day + "/" + month + "/" + year);
	else
		$("#timeshow").text(
				"AM " + (h > 9 ? h : "0" + h) + ":" + m + "  " + +day + "/"
						+ month + "/" + year);
	t = setTimeout(time, 10000); //设定定时器，循环执行             
}
</script>
</html>
